import java.io.FileNotFoundException;
import java.io.IOException;

public class Main {
    public static void openConfig(String filename) throws IOException {
        if(!filename.equals("config.txt")){
            throw new FileNotFoundException("文件不存在");
        }
    }
    public static int getElment(int[] array,int index){
        if(array == null){
            // 数组为空, 抛出空指针异常
            throw new NullPointerException("传递的数组为null");
        }
        if(index<0 || index>= array.length){
            // 数组下标越界, 抛出另一个异常
            throw new ArrayIndexOutOfBoundsException("数组越界异常");
        }
        return array[index];
    }

    public static void main(String[] args) {
        try {
            String str = null;
            str.length();
            openConfig("xxx");
            System.out.println("调用完成");
        } catch (IOException e) {
            System.out.println("进入到异常处理逻辑中");
            e.printStackTrace();
        } catch (NullPointerException e){
            System.out.println("空指针异常");
            e.printStackTrace();
        }
    }
}
